﻿Public Class BasePage
    Inherits Spring.Web.UI.Page

    ''' <summary>
    ''' Exibe um alert (javascript) para o usuário
    ''' </summary>
    Public Sub ShowMessage(ByVal _texto As String)

        Dim _scriptASerExecutado As String

        _scriptASerExecutado = String.Format("alert('{0}');", _texto)

        If ScriptManager.GetCurrent(Me.Page).IsInAsyncPostBack Then
            ScriptManager.RegisterClientScriptBlock(Me.Page, Me.Page.GetType, Guid.NewGuid.ToString, _scriptASerExecutado, True)
        Else
            Page.ClientScript.RegisterClientScriptBlock(Me.Page.GetType, Guid.NewGuid.ToString, _scriptASerExecutado, True)
        End If

    End Sub

    Private Sub Page_Error(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Error

        WebLogger.Error(Me.Request, Me.Session, Server.GetLastError)

    End Sub

End Class